'''
创建登录类的API类,添加类属性,方法
将固定不变的写入代码中
将动态变化的,通过参数传入
'''


class LoginApi():
    def __init__(self):
        self.url_verify = "http://tpshop-test.itheima.net/index.php?m=Home&c=User&a=verify&r=0.2714974674711994"
        self.url_login = "http://tpshop-test.itheima.net/index.php?m=Home&c=User&a=do_login&t=0.00533163174127238"
        self.headers = {"Content-Type": "application/x-www-form-urlencoded", "charset": "UTF-8"}

    def login(self, my_session, res_data):
        my_session.get(url=self.url_verify)
        resp = my_session.post(url=self.url_login, headers=self.headers, data=res_data)
        return resp

